<!--
 * @Description: 2_使用js创建虚拟DOM
 * @notes: 
 * @Author: 台火山
 * @Date: 2024-04-21 16:49:48
 * @LastEditors: 台火山
 * @LastEditTime: 2024-04-21 16:56:02
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>hello react</title>
</head>

<body>
    <!-- 准备号一个“容器” -->
    <div id="test"></div>

    <script type="text/javascript" src="../js/react.development.js"></script>
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <script type="text/javascript">
        // 1.创建虚拟DOM
        // React.createElement(标签名, 标签属性, 标签内容)
        const VDOM = React.createElement('h1', { id: 'title' }, React.createElement('span', {}, 'Hello,React'));
        // 2.渲染虚拟DOM到页面
        ReactDOM.render(VDOM, document.getElementById('test'));
    </script>
</body>

</html>